<template>
    <div :class="[`nav-theme-${navTheme}`,`navLayout-${navLayout}`]">
        <a-layout id="components-layout-demo-side" style="min-height: 100vh">
            <a-layout-sider
                    v-if="navLayout==='left'"
                    collapsible
                    v-model="collapsed"
                    :trigger="null"
                    :theme="navTheme"
                    width="256px"
            >
                <div class="logo">
                    Ant Design Vue Pro
                </div>
                <SiderMenu :theme="navTheme"/>
            </a-layout-sider>
            <a-layout>
                <a-layout-header style="background: #fff; padding: 0">
                    <a-icon :type="collapsed?'menu-unfold':'menu-fold'"
                            class="trigger"
                            @click="collapsed=!collapsed"
                    />
                    <Header/>
                </a-layout-header>
                <a-layout-content style="margin: 0 16px">
                    <router-view/>
                </a-layout-content>
                <a-layout-footer style="text-align: center">
                    <Footer/>
                </a-layout-footer>
            </a-layout>
        </a-layout>
        <SettingDrawer></SettingDrawer>
    </div>
</template>

<script>
  import Header from "./Header";
  import Footer from "./Footer";
  import SiderMenu from "./SiderMenu";
  import SettingDrawer from "../components/SettingDrawer";

  export default {
    name: "BasicLayout",
    components: {
      Header,
      Footer,
      SiderMenu,
      SettingDrawer

    },
    data() {
      return {
        collapsed: false
      };
    },
    computed: {
      navTheme() {
        return this.$route.query.navTheme || "dark";
      },
      navLayout() {
        return this.$route.query.navLayout || "left";
      }
    }
  };
</script>

<style scoped lang="less">
    #components-layout-demo-side .logo {
        height: 32px;
        background: rgba(255, 255, 255, .2);
        margin: 16px;
    }

    .trigger {
        padding: 0 20px;
        line-height: 64px;
        cursor: pointer;
    }

    .trigger:hover {
        background-color: #eee;
    }

    .logo {
        height: 64px;
        text-align: center;
        overflow: hidden;
        font-size: 20px;
    }

    /*less的深度查找用/deep/*/
    .nav-theme-dark /deep/ .logo {
        color: #fff;
    }

</style>